import cache from "@/plugins/cache"

import { personnel, department,classify } from "@/api/public"
// 获取人员
export const getPersonnelOpt = async () => {
  let data = cache.session.getJSON("personnel") || ""
  if (data) {
    return data
  } else {
    data = await personnel()
    cache.session.setJSON("personnel", data)
    return data
  }
}
// 获取部门
export const getDepartmentOpt = async () => {
  let data = cache.session.getJSON("department") || ""
  if (data) {
    return data
  } else {
    data = await department()
    cache.session.setJSON("department", data)
    return data
  }
}
// 获取部门
export const getCategoryOpt = async () => {
  let data = cache.session.getJSON("category") || ""
  if (data) {
    return data
  } else {
    data = await classify()
    cache.session.setJSON("category", data)
    return data
  }
}

